home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / AmigaTalk / intuition / Font.st < prev    next >
Encoding:
Text File  |  2004-01-31  |  1.7 KB  |  85 lines

  1. "----------------------------------------------"
  2. " Font Class implements control of Amiga Fonts."
  3. " Font in this class is equivalent to TextAttr."
  4. "----------------------------------------------"
  5.  
  6. Class Font :Glyph ! private myFontName diskFont !
  7. [
  8.    openFont: newFontName size: fontSize style: theFontStyle
  9.  
  10.       self    xxxNew: newFontName.
  11.  
  12.       self fontYSize: fontSize.
  13.       
  14.       self fontStyle: theFontStyle. 
  15.       
  16.       diskFont <- <primitive 188 8 private>.
  17.  
  18.       ^ self
  19. |
  20.    closeFont
  21.  
  22.       <primitive 188 10 diskFont>.
  23.  
  24.       ^ self xxxDispose      
  25. |
  26.    fontAttributes
  27.  
  28.       ^ private
  29. |
  30.    fontName
  31.  
  32.       ^ myFontName <- <primitive 188 6 0 private> "return ta_Name"
  33. |
  34.    fontName: newName
  35.  
  36.       <primitive 188 7 0 newName private>.   "set ta_Name"
  37.       
  38.       myFontName <- newName 
  39. |
  40.    fontYSize
  41.  
  42.       ^ <primitive 188 6 1 private>          "return ta_YSize"
  43. |
  44.    fontYSize: newYSize
  45.  
  46.       <primitive 188 7 1 newYSize private>   "set ta_YSize"
  47. |
  48.    fontStyle
  49.  
  50.       ^ <primitive 188 6 2 private>          "return ta_Style"
  51. |
  52.    fontStyle: newStyle
  53.  
  54.       <primitive 188 7 2 newStyle private>   "set ta_Style"
  55.  
  56.       "NORMAL=0, UNDERLINED=1, BOLD=2, ITALIC=4"
  57. |
  58.    fontFlags
  59.  
  60.       ^ <primitive 188 6 3 private>          "return ta_Flags"
  61. |
  62.    fontFlags: newFlags
  63.  
  64.       <primitive 188 7 3 newFlags private>   "set ta_Flags"
  65.  
  66.       "ROMFONT=1, DISKFONT=2, REVPATH=4, TALLDOT=8, WIDEDOT=16"
  67.       "PROPORTIONAL=32, DESIGNED=64, REMOVED=128"
  68. |
  69.    xxxDispose
  70.  
  71.       <primitive 188 4 private>.
  72.  
  73.       <primitive 250 5 0 private>.
  74.       
  75.       ^ nil
  76. |
  77.    xxNew: newFontName                " example:  'topaz.font' "
  78.  
  79.       private    <- <primitive 188 5 newFontName>.
  80.  
  81.       myFontName <- newFontName.
  82.  
  83.       ^ self
  84. ]
  85.